﻿#pragma once

#include <QDialog>
#include "ui_UserManagerForm.h"
#include"Tool/UserInfo.h"
class UserManagerForm : public QDialog
{
    Q_OBJECT

public:
    UserManagerForm(QWidget *parent = nullptr);
    ~UserManagerForm();

    void setUserInfo(QList<UserInfo>& listUsers);
    QList<UserInfo>& getUserInfos();
    void UpdateUI();
    int GetSelectIndex();
    QModelIndex getSelectItem();
    void ShowUserInfo(const UserInfo& userInfo);
    void InitMenu();
    void load();
    void save();
private slots:
    void slotShowMenu(const QPoint& pos);
    void slotMenuAdd();
    void slotMenuDelete();
    void slotMenuEdit();
    void slotMenuView();
    void slotSave();
private:
    Ui::UserManagerFormClass ui;

    QList<UserInfo> m_listUserInfo;
    QMenu* m_menu=nullptr;
    QAction* m_pActionAdd;
    QAction* m_pActionDelete;
    QAction*  m_pActionEdit;
    QAction*  m_pActionView ;
    QAction*  m_pActionSave ;

};
